load  c:\manoj\projects\substorm\OTWH200020005min;
%OTWH_daily = OTWH_daily-repmat(nanmean(OTWH_daily(:,400:500),2),[1,1440]); %remove midnight ? mean


OTWH = OTWH(1:5:end);
OTWH_fday_ts = OTWH_fday_ts(1:5:end);

load c:\manoj\projects\ace\substorm;
otw_mean = nanmean(OTWH_daily);

Longitude = 284.45; 
lt_correction = Longitude / 15;

if lt_correction > 12,
    lt_correction =  lt_correction - 12;
else,
    lt_correction = -lt_correction;
end;

local_time_start = 9;
local_time_end = 16;

st = local_time_start + lt_correction;
en = local_time_end + lt_correction;


i_counter=0;
radius_epoch = 1/24;


for i = 1:length(fday_substorm),
        
    
           i_counter = i_counter+1;
           
           L = OTWH_fday_ts > fday_substorm(i) - radius_epoch & ...
               OTWH_fday_ts < fday_substorm(i) + radius_epoch;
           
           if sum(L) > floor(radius_epoch*2*(1440/5)),
               kkk = find(L ==1);
               L(kkk(1)) = 0;
           end;
           
           SEG_OTW(i_counter,:) = OTWH(L);
           
           if (mod(i,1000) == 0)
display(i);
end;
            end;
           


